package com.th.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @Author tuhang
 * @PackageName nswcy-crowdsource-client-server
 * @Package com.th.common.enums
 * @Date 2023/6/18 14:56
 * @Version 1.0
 */
@AllArgsConstructor
@Getter
public enum UserStatus {


    YES(0,"正常"),
    NO(1,"禁用");
    private Integer code;
    private String name;

    /***
     * 获取当前类型
     * @param code
     * @return
     */
    public static UserStatus of(Integer code){
        return Stream.of(values()).
                filter(bean -> bean.code.equals(code))
                .findAny()
                .orElse(null);
    }
}
